/**
 * @USER: Administrator
 * @DATE: 2024/9/20 下午7:28
 * @VERSION: 1.0.0
 */
public class LC1629 {
    public static void main(String[] args) {

    }

    public char slowestKey(int[] releaseTimes, String keysPressed) {
        int maxTime = releaseTimes[0];
        char c = keysPressed.charAt(0);
        for (int i = 1; i < releaseTimes.length; i++) {
            if (releaseTimes[i]-releaseTimes[i-1]>=maxTime){
                if (releaseTimes[i]-releaseTimes[i-1]>maxTime){
                    c = keysPressed.charAt(i);
                    maxTime = releaseTimes[i]-releaseTimes[i-1];
                }else {
                    if (keysPressed.charAt(i) > c) {
                        c = keysPressed.charAt(i);
                    }
                }
            }

        }
        return c;
    }

}
